//index.js
//获取应用实例

import {listServices, listSubServices, listBanner} from "../../utils/request";

const app = getApp()

Page({
  data: {
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    imgUrls: [{
      img: "../../images/EmptyBanner.jpg",
      openpath: "../../pages/figure/figure"
    },{
      img: "../../images/EmptyBanner1.jpg",
      openpath: "../../pages/bankQuery/bankQuery"
    },{
      img: "../../images/EmptyBanner2.jpg",
      openpath: "../../pages/IDCard/IDCard"
    },{
      img: "../../images/EmptyBanner3.jpg",
      openpath: "../../pages/MobileHome/MobileHome"
    }],
    grid_list: [
        []
    ],
    serviceList: []
  },
  onLoad: function () {
    listServices(
        res => {
          console.log(res)
          let serviceList = res.data.data
          this.data.serviceList = serviceList
        }
    )

    listBanner(
        res => {
          console.log(res)
          let imgUrls = res.data.data
          this.data.imgUrls = imgUrls
        }
    )

  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  },
  getPhoneNumber: e => {
    console.log(e)
    console.log(e.detail.errMsg)
    console.log(e.detail.iv)
    console.log(e.detail.encryptedData)
  }
})
